package com.flyou.mvpdemo.presenter;

import android.content.Context;
import android.os.Handler;

import com.flyou.mvpdemo.impl.INetConnect;
import com.flyou.mvpdemo.impl.NetConnect;
import com.flyou.mvpdemo.view.IStstusShow;



/**
 * Created by flyou on 2016/3/1.
 */
public class ShowViewPresenter {
    private INetConnect connect;
    private IStstusShow ststusShow;

    public ShowViewPresenter(IStstusShow ststusShow) {
        this.ststusShow = ststusShow;
        connect=new NetConnect();
    }

    public void startLoading(final Context context){
        ststusShow.showProcessBar();
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if (connect.isNetConnect(context)){

                    ststusShow.startActivity();
                }
                else {
                    ststusShow.showNetError();
                }
                ststusShow.hideProcessBar();


            }
        },3000);
    }
}
